package com.baidu.location;

import java.util.ArrayList;
import java.util.List;
import org.apache.http.HttpResponse;
import org.apache.http.StatusLine;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.params.HttpParams;

final class ah extends Thread
{
  public final void run()
  {
    while (true)
    {
      int i;
      Object localObject2;
      try
      {
        HttpPost localHttpPost = new HttpPost(ak.f());
        localObject2 = new ArrayList();
        i = 0;
        if (i >= ae.t().size())
          break label140;
        if (ae.u() == 1)
        {
          ((List)localObject2).add(new BasicNameValuePair("cldc[" + i + "]", (String)ae.t().get(i)));
          break label256:
        }
        label256: label140: ((List)localObject2).add(new BasicNameValuePair("cltr[" + i + "]", (String)ae.t().get(i)));
      }
      catch (Exception localException)
      {
        return;
        localException.setEntity(new UrlEncodedFormEntity((List)localObject2, "utf-8"));
        localObject2 = new DefaultHttpClient();
        ((HttpClient)localObject2).getParams().setParameter("http.connection.timeout", Integer.valueOf(ae.g()));
        ((HttpClient)localObject2).getParams().setParameter("http.socket.timeout", Integer.valueOf(ae.g()));
        if (((HttpClient)localObject2).execute(localException).getStatusLine().getStatusCode() == 200)
        {
          ak.e();
          ae.t().clear();
          ae.v();
          return;
        }
        ak.e();
      }
      finally
      {
        ae.w();
      }
    }
  }
}